<div class="plan-view container-fluid">

  <div class="row">
    <div class="col-sm-6">
      <chart-execution [chartData]="chartData"></chart-execution>
    </div>

    <div class="col-sm-6">
      <div class="plan-detail">

        <div class="row">
          <div class="edit-toolbar col-xl-12">
            <div class="title">
              <span>计划详情</span>
            </div>
            <div class="buttons">
              <button (click)="returnTo()" type="button"
                      class="btn btn-primary btn-with-icon btn-sm back">
                <i class="fa fa-arrow-circle-left"></i>返回
              </button>
            </div>
          </div>
        </div>

        <div class="row">
          <label class="col-sm-2 col-form-label"><span>名称</span></label>
          <label class="col-sm-4 col-form-label">
            {{model.name}}
          </label>

          <label class="col-sm-2 col-form-label"><span>耗时</span></label>
          <label class="col-sm-4 col-form-label">
            {{model.estimate}}
          </label>
        </div>
        <div class="row">
          <label class="col-sm-2 col-form-label"><span>开始时间</span></label>
          <label class="col-sm-4 col-form-label">
            {{model.startTime | date:'y-MM-dd HH:mm:ss'}}
          </label>

          <label class="col-sm-2 col-form-label"><span>结束时间</span></label>
          <label class="col-sm-4 col-form-label">
            {{model.endTime | date:'y-MM-dd HH:mm:ss'}}
          </label>
        </div>
        <div class="row">
          <label class="col-sm-2 col-form-label"><span>状态</span></label>
          <label class="col-sm-10 col-form-label">
            <span *ngIf="!model.disabled">启用</span>
            <span *ngIf="model.disabled">归档</span>
          </label>
        </div>
        <div class="row">
          <label class="col-sm-2 col-form-label"><span>简介</span></label>
          <label class="col-sm-10 col-form-label">{{model.descr}}</label>
        </div>

      </div>
    </div>

  </div>

  <div class="row">
    <div class="list-toolbar col-xl-12">
      <div class="title">
        <span>测试集</span>
      </div>
      <div class="filter"></div>
      <div class="buttons">
      </div>
    </div>
  </div>
  <div class="test-sets row">
    <div class="col-sm-12 task-list">
      <table class="table">
        <thead>
        <tr>
          <th style="width: 50px;" class="id">编号</th>
          <th>标题</th>
          <th>创建人</th>
          <th>经办人</th>
          <th>所属项目</th>
          <th style="width: 350px;">执行情况</th>
          <th style="width: 100px;">状态</th>
          <th style="width: 150px;" class="opt">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let item of model.tasks; let i = index;">
          <td>{{i+1}}</td>
          <td class="pointer">{{item.name}}</td>
          <td class="pointer">{{item.userName}}</td>
          <td>
                <span *ngFor="let a of item.assignees; let i = index;">
                  <span>{{a.nickname}}</span><span *ngIf="i != item.assignees.length-1">, </span>
                </span>
          </td>
          <td>{{item.caseProjectName}}</td>
          <td>
            <execution-bar [data]="item"></execution-bar>
          </td>
          <td>{{item.status | exeStatus}}</td>
          <td>
            <span *ngIf="!item.assignedToMe">
              <span prj-privilege [privs]="'test_task:view'" *ngIf="item.countMap.total > 0" (click)="exeOrView('view', item.id)" class="link no-underline">查看</span>
              <span prj-privilege [privs]="'test_task:close'" *ngIf="item.status != 'end'" (click)="close(item, i)" class="link no-underline">关闭</span>
            </span>
            <span *ngIf="item.assignedToMe">
              <span prj-privilege [privs]="'test_task:view'" *ngIf="item.status == 'end' && item.countMap.total > 0" (click)="exeOrView('view', item.id)" class="link no-underline">查看</span>
              <span prj-privilege [privs]="'test_task:exe'" *ngIf="item.status != 'end' && item.countMap.total > 0" (click)="exeOrView('exe', item.id)" class="link no-underline">执行</span>
              <span prj-privilege [privs]="'test_task:close'" *ngIf="item.status != 'end'" (click)="close(item, i)" class="link no-underline">关闭</span>
            </span>
          </td>
        </tr>
        </tbody>
      </table>
    </div>
  </div>

</div>

<pop-dialog #modalClose (confirm)="closeConfirm()" [title]="modalTitle">
  确认关闭名为"{{task.name}}"的测试任务？
</pop-dialog>
